package com.serviceprovider.business.module.order.services.interfaces;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.common.Page;
import com.serviceprovider.business.module.order.model.Order;
import com.serviceprovider.business.module.order.model.OrderSearchCriteria;
import com.serviceprovider.business.module.order.valueobjects.OrderFilterConditionVO;
import com.serviceprovider.business.module.user.model.impl.User;

//~--- JDK imports ------------------------------------------------------------

import java.util.List;

/**
 * @author mrduongnv@gmail.com
 */
public interface IOrderService {

    /**
     * Return the Order by ID
     */
    Order findOrderById(int id);

    /**
     * Return the list of order by user ID
     */
    List<Order> findOrderByUserId(int userId);

    /**
     * Return the Order by batch's ID
     */
    Order findOrderByBatch(int bacthId);

    /**
     * Return the order by Transaction's ID
     */
    Order findOrderByTransactionId(int transactionId);

    /**
     * Return the list of order by shipping mode
     */
    List<Order> findOrderByshippingMode(String shippingMode);

    /**
     * Return the list of order by order status
     */
    List<Order> findOrderByOrderStatus(String orderStatusName);

    /**
     * Return the list of order with a date range condition
     */
    List<Order> findOrderByDateRange(String startDate, String endDate);

    /**
     * This method will search orders by given criteria.
     *
     * @param criteria search criteria object.
     * @return List of Order instance.
     */
    List<Order> findOrderBySearchCriteria(OrderSearchCriteria criteria);

    Page<Order> findOrderBySearchCriteria(OrderSearchCriteria criteria, int pageNo, int recordSize, String sortColumn,
            String sortOrder);

    /**
     * Pagination for find all the order
     */
    Page<Order> findAll(int pageNumber, int pageSize, String sortColumn, String sortOrder);

    /**
     * This method will search orders by given user id. The results are returned with pagination settings.
     *
     * @param userId     user id.
     * @param pageNumber page number
     * @param pageSize   number of result per page.
     * @return list of orders.
     */
    Page<Order> findOrderByUserId(int userId, int pageNumber, int pageSize, String sortColumn, String sortOrder);

    /**
     * Save the Order to database
     */
    Order insertOrder(Order order);

    /**
     * Update order information
     */
    void updateOrder(Order order);

    /**
     * Update order status
     */
    void updateStatus(int orderid, int statusid);

    /**
     * Update assigned user ID
     */
    void updateAssignedUserIds(Integer orderId, Integer assignedUserId);

    /**
     * Delete an order in database
     */
    void deleteOrder(int orderId);

    /**
     * Save a comment for order
     */
    void saveOrderComments(String comment, int orderID);

    /**
     * Update order comment
     */
    void updateComment(int commentId, String newComment);

    /**
     * Delete comment with ID
     */
    void deleteComment(int commentId);

    /**
     * Find comment for order
     */
    List<String> findComments(int orderId);

    /**
     * Return all service provider
     */
    List<User> findAllProviders();

    /**
     * Delete order by batch's ID
     */
    void deleteByBatchId(Integer batchId);

    /**
     * Returns a list of all orders using a filter
     */
    List<Order> getAllUsingFilter(List<OrderFilterConditionVO> list);

    Page<Order> getAllUsingFilter(List<OrderFilterConditionVO> list, int pageNo, int recordSize, String sortColumn,
                                  String sortOrder);
}



